home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0044_Hard Drive Report.pas < prev    next >
Pascal/Delphi Source File  |  1993-09-26  |  2KB  |  65 lines

  1. (*
  2. ===========================================================================
  3.  BBS: Canada Remote Systems
  4. Date: 09-20-93 (01:47)             Number: 8840
  5. From: CHRIS PRIEDE                 Refer#: NONE
  6.   To: WIM VAN.VOLLENHOVEN           Recvd: NO
  7. Subj: Disk & Drives                  Conf: (1617) L-Pascal
  8. ---------------------------------------------------------------------------
  9. WV>  - I can't figure out how to determain if the drive is a ramdisk
  10. WV>    or a fixed disk.
  11.  
  12.     RAM disks have only one copy of FAT, while floppies and hard disks
  13. should have at least two. Use DOS function 1Fh or 32h to get this
  14. information for current/specified drive. The following program uses
  15. function 1F:
  16.  
  17. ===========================================================
  18. *)
  19.  
  20. program TellMeAllAboutMyDrive;
  21. (* Released to public domain, K. Priede, 1993 *)
  22.  
  23. uses Dos;
  24.  
  25. type
  26.   (* record matching DOS (2.0+) Drive Parameter Block.
  27.    * defined only interesting items, DOS structure is bigger *)
  28.   DosDPB = record
  29.     Drive, UnitNo: byte;
  30.     BytesPerSector: word;
  31.     LastSectorInCluster: byte;
  32.     ShiftCount: byte;
  33.     ReservedSectors: word;
  34.     FATCount: byte;
  35.     RootDirEntries, FirstDataSector, LastCluster: word;
  36.   end;
  37.  
  38. var
  39.   Regs: Registers;
  40.  
  41. begin
  42.   (* func. 1Fh -- Get DPB
  43.    * returns: AL = 0 if successful, DS:BX -> DBP *)
  44.   Regs.AH := $1F;
  45.   MsDos(Regs);
  46.   (* now show what we got ... *)
  47.   if Regs.AL = 0 then
  48.     with DosDPB(Ptr(Regs.DS, Regs.BX)^) do
  49.     begin
  50.       Writeln(#10#13'Parameters for drive ',
  51.         Chr(Ord('A') + Drive), ':'#13#10);
  52.       Writeln('Sector size: ':24, BytesPerSector, ' bytes');
  53.       Writeln('Sectors per cluster: ':24, LastSectorInCluster +1);
  54.       Writeln('Clusters on drive: ':24, LastCluster -1);
  55.       Writeln('Total drive space: ':24, longint(BytesPerSector) *
  56.         (LastSectorInCluster +1) * (LastCluster -1),' bytes'#13#10);
  57.       Writeln('Number of FATs: ':24, FATCount);
  58.       Writeln('Root directory size: ':24, RootDirEntries, ' entries');
  59.     end
  60.    else Writeln('Error!');
  61. end.
  62. ===========================================================
  63. ---
  64.  ■ RNET 2.00m: ILink: Faster-Than-Light ■ Atlanta GA ■ 404-296-3120 / 299-3930
  65.